//
//  NSMutableAttributedString+TZExtension.m
//  TZOCExtension
//
//  Created by Tim.Z on 2017/1/3.
//  Copyright © 2017年 Tim.Z. All rights reserved.
//

#import "NSMutableAttributedString+TZExtension.h"

@implementation NSMutableAttributedString (TZExtension)

- (void)tz_settingColor:(UIColor *)color Range:(NSRange)range{
    
    [self addAttribute:NSForegroundColorAttributeName value:color range:range];
}

- (void)tz_settingFont:(UIFont *)font Range:(NSRange)range{
    
    [self addAttribute:NSFontAttributeName value:font range:range];
}

- (void)tz_settingFontAndColor:(UIFont *)font color:(UIColor *)color Range:(NSRange)range{
    [self tz_settingFont:font Range:range];
    [self tz_settingColor:color Range:range];
}

- (void)tz_settingColor:(UIColor *)color subString:(NSString *)subString{
    [self tz_settingColor:color Range:[self.string rangeOfString:subString]];
}

- (void)tz_settingFont:(UIFont *)font subString:(NSString *)subString{
    [self tz_settingFont:font Range:[self.string rangeOfString:subString]];
}

- (void)tz_settingFontAndColor:(UIFont *)font color:(UIColor *)color subString:(NSString *)subString{
    [self tz_settingColor:color subString:subString];
    [self tz_settingFont:font subString:subString];
}

@end
